<template>
  <div>
    <h3>历史记录页面</h3>
    {{ host }}
    <table style="width:500px ;margin:0 auto">
        <tr>
            <th>编号</th>
            <th>歌名</th>
            <th>歌手</th>
        </tr>
        <tr v-for="(item,i) in host" :key="i">
            <td>{{ item.id }}</td>
            <td>{{ item.name }}</td>
            <td>{{ item.singn }}</td>
        </tr>
    </table>
  </div>
</template>

<script>
import axios from 'axios'
export default {
    data(){
        return{
            host:[],
        }
    },
    mounted(){
        this.getHost()
    },
    methods:{
        getHost(){
            axios.get('http://127.0.0.1:8000/user/hostroy/',{
                params:{
                  token: localStorage.getItem("token"),
                } 
            })
            .then(resp=>{
                console.log(resp);
                this.host=resp.data.data
            })
            .catch(err=>{
                console.log(err);
            })
        }
    }
}
</script>

<style>

</style>